package com.fang.common.common;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author Bernie_fang
 * @Description: 基础放回类
 * @create 2024/10/2 21:56
 **/
@Data
@NoArgsConstructor
public class CommonResult<T> implements Serializable {

    private String code;
    private String message;
    @JsonInclude(JsonInclude.Include.NON_NULL)//即如果加该注解的字段为null,那么就不序列化这个字段了。
    private T data;

    public CommonResult(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
}
